<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib uri="/WEB-INF/quik_function.tld" prefix="qu"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<title>咨客_房间详情</title>
		<link href="<c:url value="/resources/css/style.css" />" rel="stylesheet" type="text/css">
		<link href="<c:url value="/resources/css/default/easyui.css" />" rel="stylesheet" type="text/css">
		<link href="<c:url value="/resources/css/icon.css" />" rel="stylesheet" type="text/css">
		<script type="text/javascript" src="<c:url value="/resources/js/jquery-1.7.2.js" />"></script>
		<script type="text/javascript" src="<c:url value="/resources/js/zDialog/zDrag.js" />"></script>
		<script type="text/javascript" src="<c:url value="/resources/js/zDialog/zDialog.js" />"></script>
		<script type="text/javascript" src="<c:url value="/resources/js/util.js" />"></script>
		<script type="text/javascript">
			function onReturn(){
				location.href = "${pageContext.request.contextPath}/consultRoom/roomList";
			}
			
			function onAuth(id, subItemId, rowid, module){
				$("#operatePass").val('');
				$("#operateAccount").val('');
				
				var diag = new Dialog();
				diag.Width = 300;
				diag.Height = 110;
				diag.Drag=false;
				diag.Title = "授权操作";
				diag.InvokeElementId = "passwordDiv";
				diag.OKEvent = function(){
					if($id("operatePass").value == '' || $id("operateAccount").value == ''){
						Dialog.alert("请授权!");
						return false;
					}
					diag.close();
					onCancelOrder(id, subItemId, rowid, module);
				};
				diag.show();
			}
			
			//取消
			function onCancelOrder(id, subItemId, rowid, module){
				var service = '${PRODUCT_NO}';
				var chess = '${PRODUCT_NO}';
				if(module == 'service')
					service = '${PRODUCT_YES}';
				else if(module == 'chess')
					chess = '${PRODUCT_YES}';
					
				$.ajax({
					url:'../consultBilling/cancelOrder',
					data:{'itemId':id, 'subItemId':subItemId, 'service':service, 'chess':chess,
						  'operateAccount':$.trim($("#operateAccount").val()),
						  'operatePass':$.trim($("#operatePass").val())},
					type:'post',
					dataType:'text',
					async:false,
					cache:false,
					success:function(data){						
						$("#operatePass").val('');
						
						if(data == 'success'){							
							$("#" + module + "STATUS" + rowid).html('取消');
							$("#" + module + "OP" + rowid).html('');
							$.messager.alert('操作结果', "取消成功!");
						}else
							$.messager.alert('操作结果', data);
					}
				});
			}
			
			//起钟
			function onStart(id, subItemId, service, chess, rowid, module){
				$.messager.confirm('操作确认', '确定开始起钟?', function(r){
					if (r){
						$.ajax({
							url:'../consultBilling/start',
							data:{'itemId':id, 'subItemId':subItemId, 'service':service, 'chessRoom':chess},
							type:'post',
							dataType:'json',
							async:false,
							cache:false,
							success:function(data){								
								if(data.result == 'success'){
									var status, opBtn = '';
									if(module == 'chess'){
										status = '使用中';
									}else{
										status = "服务中";
										opBtn = "<a href='#' onclick='onAlterWorker(" + id + ", " + subItemId + ", " + rowid + ")' style='cursor:pointer;'>换技师</a>&nbsp;&nbsp;";
										opBtn += "<a href='#' onclick='quitCall("+ id + ", "+ subItemId + ", " + rowid + ")' style='cursor:pointer;'>退钟</a>&nbsp;&nbsp;";
									}
									
									opBtn += "<a href='#' onclick='onEnd(" + id + ", " + subItemId + "," + service + 
											 ", " + chess + "," + rowid + ",\"" + module + "\")' style='cursor:pointer;'>落钟</a>&nbsp;&nbsp;";
									opBtn += "<a href='#' onclick='onAuth(" + id + ", "+ subItemId + ", " + rowid + ",\"" + module + "\")' style='cursor:pointer;'>取消</a>";	
							
									$("#" + module + "STATUS" + rowid).html(status);
									$("#" + module + "OP" + rowid).html(opBtn);
									$("#" + module + "STARTTIME" + rowid).html(data.obj);
									$("#" + module + "SubItemId" + rowid).val(subItemId);
								}else{
									$.messager.alert('操作结果', "系统繁忙!");
								}
							}
						});
					}
				});
			}
			
			//落钟
			function onEnd(id, subItemId, service, chess, rowid, module){
				$.messager.confirm('操作确认', '确定落钟?', function(r){
					if (r){
						$.ajax({
							url:'../consultBilling/end',
							data:{'itemId':id, 'subItemId':subItemId, 'service':service, 'chessRoom':chess},
							type:'post',
							dataType:'json',
							async:false,
							cache:false,
							success:function(data){
								if(data.result == 'success'){
									opBtn = "<a href='#' onclick='onReverseEnd(" + id +", " + subItemId + "," + service + 
									", " + chess + "," + rowid + ",\"" + module + "\")' style='cursor:pointer;'>反落钟</a>&nbsp;&nbsp;";
									opBtn += "<a href='#' onclick='onAuth(" + id + ", " + subItemId + ", " + rowid + ",\"" + module + "\")' style='cursor:pointer;'>取消</a>";
									
									$("#" + module + "STATUS" + rowid).html('结束');
									$("#" + module + "OP" + rowid).html(opBtn);
									$("#" + module + "ENDTIME" + rowid).html(data.obj);
								}else{
									$.messager.alert('操作结果', "系统繁忙!");
								}
							}
						});
					}
				});
			}
			
			//反落钟
			function onReverseEnd(id, subItemId, service, chess, rowid, module){
				$.messager.confirm('操作确认', '确定反落钟?', function(r){
					if (r){
						$.ajax({
							url:'../consultBilling/reverseEnd',
							data:{'itemId':id, 'subItemId':subItemId, 'service':service, 'chessRoom':chess},
							type:'post',
							dataType:'text',
							async:false,
							cache:false,
							success:function(data){
								if(data == 'success'){
									var opBtn = '';
									var status = '';									
									if(module == 'chess'){
										status = '使用中';
									}else{
										//加服务类
										status = "服务中";
										opBtn = "<a href='#' onclick='onAlterWorker(" + id + ", " + subItemId + ", " + rowid + ")' style='cursor:pointer;'>换技师</a>&nbsp;&nbsp;";
										opBtn += "<a href='#' onclick='quitCall("+ id + ", " + subItemId + ", " + rowid + ")' style='cursor:pointer;'>退钟</a>&nbsp;&nbsp;";
									}
									
									opBtn += "<a href='#' onclick='onEnd(" + id + ", " + $("#" + module + "SubItemId" + rowid).val() + "," + service + 
										     ", " + chess + "," + rowid + ",\"" + module + "\")' style='cursor:pointer;'>落钟</a>&nbsp;&nbsp;";
									opBtn += "<a href='#' onclick='onAuth(" + id + ", " + subItemId + ", " + rowid + ",\"" + module + "\")' style='cursor:pointer;'>取消</a>";
									
									$("#" + module + "STATUS" + rowid).html(status);
									$("#" + module + "OP" + rowid).html(opBtn);
									$("#" + module + "ENDTIME" + rowid).html('');
								}else
									$.messager.alert('操作结果', data);
							}
						});
					}
				});
			}
			
			//分配技师
			function onService(itemId, subItemId, rowid){
				var diag = new Dialog();
				diag.Width = 620;
				diag.Height = 400;
				diag.Drag=false;
				diag.Title = "选择技师";
				diag.URL = "../consultBilling/initService?billingItemId=" + itemId;
				diag.OKEvent = function(){					
					if(diag.innerFrame.contentWindow.document.getElementById('rowIndex').value != 2){
						Dialog.alert("请选择技师!");
						return false;
					}
					var workerNo = diag.innerFrame.contentWindow.document.getElementById('selWorkerNo').value;
					var turnTypeObj = diag.innerFrame.contentWindow.document.getElementById('turnType');
					var index = turnTypeObj.selectedIndex;
					
					diag.close();
					onDispatch(itemId, subItemId, workerNo, turnTypeObj.options[index].value, turnTypeObj.options[index].text, rowid);
				};
				diag.show();
			}
			
			function onDispatch(itemId, subItemId, workerNo, turnType, turnName, rowid){
				$.ajax({
					url:'../consultBilling/service',
					data:{'itemId':itemId, 'subItemId':subItemId, 'workerNo':workerNo, 'turnType':turnType},
					type:'post',
					dataType:'text',
					async:false,
					cache:false,
					success:function(data){
						if(data == 'success'){							
							var opBtn = "<a href='#' onclick='onAlterWorker(" + itemId + ", " + subItemId + ", " + rowid + ")' style='cursor:pointer;'>换技师</a>&nbsp;&nbsp;";
							opBtn += "<a href='#' onclick='onStart(" + itemId + ", " + subItemId + ", \"${PRODUCT_YES}\", \"${PRODUCT_NO}\", " + rowid + ",\"service\")' style='cursor:pointer;'>起钟</a>&nbsp;&nbsp;";
							opBtn += "<a href='#' onclick='onAuth(" + itemId + ", " + subItemId + ", " + rowid + ",\"service\")' style='cursor:pointer;'>取消</a>";
							
							$("#serviceSTATUS" + rowid).html('已分配技师');
							$("#serviceTURNTYPE" + rowid).html(turnName);
							$("#serviceWORKER" + rowid).html(workerNo);
							$("#serviceOP" + rowid).html(opBtn);
						}else
							$.messager.alert('操作结果','系统繁忙!');
					}
				});
			}
			
			//更换技师
			function onAlterWorker(itemId, subItemId, rowid){
				var diag = new Dialog();
				diag.Width = 620;
				diag.Height = 400;
				diag.Drag=false;
				diag.Title = "选择技师";
				diag.URL = "../consultBilling/initService?billingItemId=" + itemId;
				diag.OKEvent = function(){					
					if(diag.innerFrame.contentWindow.document.getElementById('rowIndex').value != 2){
						Dialog.alert("请选择需要更换技师!");
						return false;
					}
					var workerNo = diag.innerFrame.contentWindow.document.getElementById('selWorkerNo').value;
					diag.close();
					onAlter(itemId, subItemId, workerNo, rowid);
				};
				diag.show();
			}
			
			function onAlter(itemId, subItemId, workerNo, rowid){
				var srcWorkerNo = $("#serviceWORKER" + rowid).html();
				$.ajax({
					url:'../consultBilling/alterWorker',
					data:{'itemId':itemId,'workerNo':workerNo, 'subItemId':subItemId, 'srcWorkerNo':srcWorkerNo},
					type:'post',
					dataType:'text',
					async:false,
					cache:false,
					success:function(data){
						if(data == 'success'){
							$("#serviceWORKER" + rowid).html(workerNo);
						}else
							$.messager.alert('操作结果','系统繁忙!');
					}
				});
			}
			
			//退钟
			function quitCall(itemId, subItemId, rowid){
				$.messager.confirm('操作确认', '确定退钟?', function(r){
					if (r){
						$.ajax({
							url:'../consultBilling/quitCall',
							data:{'subItemId':subItemId},
							type:'post',
							dataType:'text',
							async:false,
							cache:false,
							success:function(data){
								if(data == 'success'){
									var opBtn = "<a href='#' onclick='onEnd(" + itemId + ", " + subItemId + ",\"${PRODUCT_YES}\", \"${PRODUCT_NO}\"," + rowid + ",\"service\")' style='cursor:pointer;'>落钟</a>&nbsp;&nbsp;";
									opBtn += "<a href='#' onclick='onAuth(" + itemId + ", " + subItemId + ", " + rowid + ",\"service\")' style='cursor:pointer;'>取消</a>";
									
									$("#serviceWORKER" + rowid).html('');
									$("#serviceTURNTYPE" + rowid).html('');
									$("#serviceOP" + rowid).html(opBtn);
								}else
									$.messager.alert('操作结果', data);
							}
						});
					}
				});
			}
		</script>
	</head>
	
	<body>
		<c:import url="/WEB-INF/resources/common/consult_header.jsp" />
		
		<h1>房间信息</h1>
		
		<table style="border-collapse: collapse;width:600px;text-align: center;">
			<tr>
				<td style="border: 1px solid #7F9DB9;font-weight: bold;">房间号</td>
				<td style="border: 1px solid #7F9DB9;">${room.room_no}</td>
				<td style="border: 1px solid #7F9DB9;font-weight: bold;">房间类型</td>
				<td style="border: 1px solid #7F9DB9;">${room.roomTypeName }</td>
			</tr>
			
			<tr>
				<td style="border: 1px solid #7F9DB9;font-weight: bold;">房间人数</td>
				<td style="border: 1px solid #7F9DB9;">${room.capacity}</td>
				<td style="border: 1px solid #7F9DB9;font-weight: bold;">房间区域</td>
				<td style="border: 1px solid #7F9DB9;">${room.roomAreaName}</td>
			</tr>
			
			<tr>
				<td style="border: 1px solid #7F9DB9;font-weight: bold;">房间电话</td>
				<td style="border: 1px solid #7F9DB9;">${room.tel_no}</td>
				<td style="border: 1px solid #7F9DB9;font-weight: bold;">房间状态</td>
				<td style="border: 1px solid #7F9DB9;" id="statusTd">${room.statusName}</td>
			</tr>
		</table>
		
		<div id="roomDIV">
			<h1>关联房间</h1>
			<table id="roomTable" style="border-collapse: collapse;width:300px;text-align: center;">
				<tr>
					<td style="border: 1px solid #7F9DB9;font-weight: bold;">序号</td>
					<td style="border: 1px solid #7F9DB9;font-weight: bold;">房间类型</td>
					<td style="border: 1px solid #7F9DB9;font-weight: bold;">房间号</td>
				</tr>
				<c:if test="${fn:length(roomList) == 0}">
					<tr><td colspan="3" style="border: 1px solid #7F9DB9;font-weight: bold; text-align: center;">无关联房间</td></tr>
				</c:if>
				<%int tokenIndex = 0;%>
				<c:forEach var="rooms" items="${roomList}" varStatus="status">
					<c:if test="${rooms.room_no != room.room_no}">
					<% tokenIndex ++; %>
					<tr>
						<td style="border: 1px solid #7F9DB9;font-weight: bold;"><%out.print(tokenIndex);%></td>
						<td style="border: 1px solid #7F9DB9;font-weight: bold;">${rooms.roomTypeName}</td>
						<td style="border: 1px solid #7F9DB9;font-weight: bold;">${rooms.room_no}</td>
					</tr>
					</c:if>
				</c:forEach>				
				<c:set var="tokenIndex" value="<%=tokenIndex%>" scope="page"></c:set>			
				<c:if test="${tokenIndex == 0}">
					<tr><td colspan="3" style="border: 1px solid #7F9DB9;font-weight: bold; text-align: center;">无关联房间</td></tr>
				</c:if>
			</table>
		</div>
				
		<div id="tokenDIV" style="margin-top: 5px;">
			<h1>关联手牌</h1>
			<table id="tokenTable" style="border-collapse: collapse;width:300px;text-align: center;">
				<tr>
					<td style="border: 1px solid #7F9DB9;font-weight: bold;">序号</td>
					<td style="border: 1px solid #7F9DB9;font-weight: bold;">手牌类型</td>
					<td style="border: 1px solid #7F9DB9;font-weight: bold;">手牌号</td>
				</tr>
				<c:if test="${fn:length(tokenList) == 0}">
					<tr><td colspan="3" style="border: 1px solid #7F9DB9;font-weight: bold;text-align: center;">无关联手牌</td></tr>
				</c:if>
				<c:forEach var="tokens" items="${tokenList}" varStatus="status">
					<tr>
						<td style="border: 1px solid #7F9DB9;font-weight: bold;">${status.index + 1}</td>
						<td style="border: 1px solid #7F9DB9;font-weight: bold;">${tokens.tokenTypeName}</td>
						<td style="border: 1px solid #7F9DB9;font-weight: bold;">${tokens.token_no}</td>
					</tr>
				</c:forEach>
			</table>
		</div>
		
		<div id="billingDIV">
			<h1>关联帐单</h1>
			<table id="billingTable" style="border-collapse: collapse;width:400px;text-align: center;">
				<tr>
					<td style="border: 1px solid #7F9DB9;font-weight: bold;">序号</td>
					<td style="border: 1px solid #7F9DB9;font-weight: bold;">帐单类型</td>
					<td style="border: 1px solid #7F9DB9;font-weight: bold;">帐单号</td>
				</tr>
				<c:if test="${fn:length(billingList) == 0}">
					<tr><td colspan="3" style="border: 1px solid #7F9DB9;font-weight: bold; text-align: center;">无关联帐单</td></tr>
				</c:if>
				<c:forEach var="billings" items="${billingList}" varStatus="status">
					<tr>
						<td style="border: 1px solid #7F9DB9;font-weight: bold;">${status.index + 1}</td>
						<td style="border: 1px solid #7F9DB9;font-weight: bold;">
							<c:choose>
								<c:when test="${billings.if_master == IF_MASTER }">主帐单</c:when>
								<c:otherwise>关联帐单</c:otherwise>
							</c:choose>
						</td>
						<td style="border: 1px solid #7F9DB9;font-weight: bold;">${billings.billing_no}</td>
					</tr>
				</c:forEach>
			</table>
		</div>
		
		<div id="consumeDIV">			
			<h1>服务类</h1>
			<table id="consumeTable" style="border-collapse: collapse;width:1000px;text-align: center;">
				<tr>
					<td style="border: 1px solid #7F9DB9;font-weight: bold;">序号</td>
					<td style="border: 1px solid #7F9DB9;font-weight: bold;">商品名</td>
					<td style="border: 1px solid #7F9DB9;font-weight: bold;">单价</td>					
					<td style="border: 1px solid #7F9DB9;font-weight: bold;">单位</td>
					<td style="border: 1px solid #7F9DB9;font-weight: bold;">房间号</td>
					<td style="border: 1px solid #7F9DB9;font-weight: bold;">手牌</td>
					<td style="border: 1px solid #7F9DB9;font-weight: bold;">状态</td>
					<td style="border: 1px solid #7F9DB9;font-weight: bold;">技师工号</td>
					<td style="border: 1px solid #7F9DB9;font-weight: bold;">起钟类型</td>
					<td style="border: 1px solid #7F9DB9;font-weight: bold;">起钟时间</td>
					<td style="border: 1px solid #7F9DB9;font-weight: bold;">结束时间</td>
					<td style="border: 1px solid #7F9DB9;font-weight: bold;">赠送</td>
					<td style="border: 1px solid #7F9DB9;font-weight: bold;">冲单</td>
					<td style="border: 1px solid #7F9DB9;font-weight: bold;">操作</td>
				</tr>
				<c:if test="${fn:length(serviceList) == 0}">
					<tr><td colspan="14" style="border: 1px solid #7F9DB9;font-weight: bold; text-align: center;">无服务类消费</td></tr>
				</c:if>
				<c:forEach var="service" items="${serviceList}" varStatus="status">
					<tr>
						<td style="border: 1px solid #7F9DB9;font-weight: bold;">${status.index + 1}
							<input type="hidden" name="serviceSubItemId${status.index}" id="serviceSubItemId${status.index}" value="${service.subItemId}"/>
						</td>
						<td style="border: 1px solid #7F9DB9;font-weight: bold;">${service.productName}</td>
						<td style="border: 1px solid #7F9DB9;font-weight: bold;">￥${qu:parsePrice(service.price)}</td>
						<td style="border: 1px solid #7F9DB9;font-weight: bold;">${service.unit}</td>
						<td style="border: 1px solid #7F9DB9;font-weight: bold;">${service.roomNo}</td>
						<td style="border: 1px solid #7F9DB9;font-weight: bold;">${service.tokenNo}</td>
						<td style="border: 1px solid #7F9DB9;font-weight: bold;" id="serviceSTATUS${status.index}">${service.statusName}</td>
						<td style="border: 1px solid #7F9DB9;font-weight: bold;" id="serviceWORKER${status.index}">${service.workerNo}</td>
						<td style="border: 1px solid #7F9DB9;font-weight: bold;" id="serviceTURNTYPE${status.index}">${service.turnTypeName}</td>
						<td style="border: 1px solid #7F9DB9;font-weight: bold;" id="serviceSTARTTIME${status.index}">${service.startTime}</td>
						<td style="border: 1px solid #7F9DB9;font-weight: bold;" id="serviceENDTIME${status.index}">${service.endTime}</td>
						<td style="border: 1px solid #7F9DB9;font-weight: bold;">
							<c:choose>
								<c:when test="${service.is_free == IS_ABLE}">是</c:when>
								<c:otherwise>否</c:otherwise>
							</c:choose>
						</td>
						<td style="border: 1px solid #7F9DB9;font-weight: bold;">
							<c:choose>
								<c:when test="${service.is_subtract == IS_ABLE}">是</c:when>
								<c:otherwise>否</c:otherwise>
							</c:choose>
						</td>
						<td style="border: 1px solid #7F9DB9;font-weight: bold;" id="serviceOP${status.index}">
							<c:if test="${service.status == 'order'}">
								<a href="#" onclick="onService(${service.id}, ${service.subItemId}, ${status.index})"  style="cursor:pointer;">分配技师</a>&nbsp;&nbsp;
								<a href="#" onclick="onAuth(${service.id}, ${service.subItemId}, ${status.index},'service')" style="cursor:pointer;">取消</a>
							</c:if>
							<c:if test="${service.status == 'allocation'}">
								<a href="#" onclick="onAlterWorker(${service.id}, ${service.subItemId }, ${status.index})"  style="cursor:pointer;">换技师</a>&nbsp;&nbsp;
								<a href="#" onclick="onStart(${service.id},  ${service.subItemId}, ${PRODUCT_YES}, ${PRODUCT_NO}, ${status.index},'service')"  style="cursor:pointer;">起钟</a>&nbsp;&nbsp;
								<a href="#" onclick="onAuth(${service.id}, ${service.subItemId}, ${status.index},'service')" style="cursor:pointer;">取消</a>
							</c:if>
							<c:if test="${service.status == 'service'}">
								<c:if test="${fn:length(service.workerNo) > 0}">
									<a href="#" onclick="onAlterWorker(${service.id}, ${service.subItemId }, ${status.index})"  style="cursor:pointer;">换技师</a>&nbsp;&nbsp;
									<a href="#" onclick="quitCall(${service.id}, ${service.subItemId}, ${status.index})"  style="cursor:pointer;">退钟</a>&nbsp;&nbsp;
								</c:if>
								<a href="#" onclick="onEnd(${service.id},  ${service.subItemId}, ${PRODUCT_YES}, ${PRODUCT_NO}, ${status.index},'service')"  style="cursor:pointer;">落钟</a>&nbsp;&nbsp;
								<a href="#" onclick="onAuth(${service.id}, ${service.subItemId}, ${status.index},'service')" style="cursor:pointer;">取消</a>
							</c:if>
							<c:if test="${service.status == 'end'}">
								<a href="#" onclick="onReverseEnd(${service.id}, ${service.subItemId}, ${PRODUCT_YES}, ${PRODUCT_NO}, ${status.index},'service')"  style="cursor:pointer;">反落钟</a>
								<a href="#" onclick="onAuth(${service.id}, ${service.subItemId}, ${status.index},'service')" style="cursor:pointer;">取消</a>
							</c:if>
						</td>
					</tr>
				</c:forEach>			
			</table>
			<h1>棋牌类</h1>
			<table id="consumeTable" style="border-collapse: collapse;width:1000px;text-align: center;">
				<tr>
					<td style="border: 1px solid #7F9DB9;font-weight: bold;">序号</td>
					<td style="border: 1px solid #7F9DB9;font-weight: bold;">商品名</td>
					<td style="border: 1px solid #7F9DB9;font-weight: bold;">单价</td>
					<td style="border: 1px solid #7F9DB9;font-weight: bold;">单位</td>
					<td style="border: 1px solid #7F9DB9;font-weight: bold;">房间号</td>
					<td style="border: 1px solid #7F9DB9;font-weight: bold;">手牌</td>
					<td style="border: 1px solid #7F9DB9;font-weight: bold;">状态</td>
					<td style="border: 1px solid #7F9DB9;font-weight: bold;">起钟时间</td>
					<td style="border: 1px solid #7F9DB9;font-weight: bold;">结束时间</td>
					<td style="border: 1px solid #7F9DB9;font-weight: bold;">赠送</td>
					<td style="border: 1px solid #7F9DB9;font-weight: bold;">冲单</td>
					<td style="border: 1px solid #7F9DB9;font-weight: bold;">操作</td>
				</tr>
				<c:if test="${fn:length(chessList) == 0}">
					<tr><td colspan="12" style="border: 1px solid #7F9DB9;font-weight: bold; text-align: center;">无棋牌类消费</td></tr>
				</c:if>
				<c:forEach var="chess" items="${chessList}" varStatus="status">
					<tr>
						<td style="border: 1px solid #7F9DB9;font-weight: bold;">${status.index + 1}
							<input type="hidden" name="chessSubItemId${status.index}" id="chessSubItemId${status.index}" value="${chess.subItemId}"/>
						</td>
						<td style="border: 1px solid #7F9DB9;font-weight: bold;">${chess.productName}</td>
						<td style="border: 1px solid #7F9DB9;font-weight: bold;">￥${qu:parsePrice(chess.price)}</td>
						<td style="border: 1px solid #7F9DB9;font-weight: bold;">${chess.unit}</td>
						<td style="border: 1px solid #7F9DB9;font-weight: bold;">${chess.roomNo}</td>
						<td style="border: 1px solid #7F9DB9;font-weight: bold;">${chess.tokenNo}</td>
						<td style="border: 1px solid #7F9DB9;font-weight: bold;" id="chessSTATUS${status.index}">${chess.statusName}</td>
						<td style="border: 1px solid #7F9DB9;font-weight: bold;" id="chessSTARTTIME${status.index}">${chess.startTime}</td>
						<td style="border: 1px solid #7F9DB9;font-weight: bold;" id="chessENDTIME${status.index}">${chess.endTime}</td>
						<td style="border: 1px solid #7F9DB9;font-weight: bold;">
							<c:choose>
								<c:when test="${chess.is_free == IS_ABLE}">是</c:when>
								<c:otherwise>否</c:otherwise>
							</c:choose>
						</td>
						<td style="border: 1px solid #7F9DB9;font-weight: bold;">
							<c:choose>
								<c:when test="${chess.is_subtract == IS_ABLE}">是</c:when>
								<c:otherwise>否</c:otherwise>
							</c:choose>
						</td>
						<td style="border: 1px solid #7F9DB9;font-weight: bold;" id="chessOP${status.index}">
							<c:if test="${chess.status == 'order'}">
								<a href="#" onclick="onStart(${chess.id},  ${chess.subItemId}, ${PRODUCT_NO}, ${PRODUCT_YES}, ${status.index},'chess')"  style="cursor:pointer;">起钟</a>&nbsp;&nbsp;
								<a href="#" onclick="onAuth(${chess.id}, ${chess.subItemId}, ${status.index},'chess')" style="cursor:pointer;">取消</a>
							</c:if>
							<c:if test="${chess.status == 'used'}">
								<a href="#" onclick="onEnd(${chess.id},  ${chess.subItemId}, ${PRODUCT_NO}, ${PRODUCT_YES}, ${status.index},'chess')"  style="cursor:pointer;">落钟</a>&nbsp;&nbsp;
								<a href="#" onclick="onAuth(${chess.id}, ${chess.subItemId}, ${status.index},'chess')" style="cursor:pointer;">取消</a>
							</c:if>
							<c:if test="${chess.status == 'end'}">
								<a href="#" onclick="onReverseEnd(${chess.id}, ${chess.subItemId}, ${PRODUCT_NO}, ${PRODUCT_YES}, ${status.index},'chess')"  style="cursor:pointer;">反落钟</a>
								<a href="#" onclick="onAuth(${chess.id}, ${chess.subItemId}, ${status.index},'chess')" style="cursor:pointer;">取消</a>
							</c:if>
						</td>
					</tr>
				</c:forEach>
			</table>
			<h1>消费</h1>
			<table id="consumeTable" style="border-collapse: collapse;width:1000px;text-align: center;">
				<tr>
					<td style="border: 1px solid #7F9DB9;font-weight: bold;">序号</td>
					<td style="border: 1px solid #7F9DB9;font-weight: bold;">商品名</td>
					<td style="border: 1px solid #7F9DB9;font-weight: bold;">单价</td>
					<td style="border: 1px solid #7F9DB9;font-weight: bold;">数量</td>
					<td style="border: 1px solid #7F9DB9;font-weight: bold;">单位</td>
					<td style="border: 1px solid #7F9DB9;font-weight: bold;">房间号</td>
					<td style="border: 1px solid #7F9DB9;font-weight: bold;">手牌</td>
					<td style="border: 1px solid #7F9DB9;font-weight: bold;">状态</td>
					<td style="border: 1px solid #7F9DB9;font-weight: bold;">赠送</td>
					<td style="border: 1px solid #7F9DB9;font-weight: bold;">冲单</td>
					<td style="border: 1px solid #7F9DB9;font-weight: bold;">操作</td>
				</tr>
				<c:if test="${fn:length(otherList) == 0}">
					<tr><td colspan="11" style="border: 1px solid #7F9DB9;font-weight: bold; text-align: center;">无其它类消费</td></tr>
				</c:if>
				<c:forEach var="other" items="${otherList}" varStatus="status">
					<tr>
						<td style="border: 1px solid #7F9DB9;font-weight: bold;">${status.index + 1}</td>
						<td style="border: 1px solid #7F9DB9;font-weight: bold;">${other.productName}</td>
						<td style="border: 1px solid #7F9DB9;font-weight: bold;">￥${qu:parsePrice(other.price)}</td>
						<td style="border: 1px solid #7F9DB9;font-weight: bold;">${other.qty}</td>
						<td style="border: 1px solid #7F9DB9;font-weight: bold;">${other.unit}</td>
						<td style="border: 1px solid #7F9DB9;font-weight: bold;">${other.roomNo}</td>
						<td style="border: 1px solid #7F9DB9;font-weight: bold;">${other.tokenNo}</td>
						<td style="border: 1px solid #7F9DB9;font-weight: bold;" id="otherSTATUS${status.index}">${other.statusName}</td>
						<td style="border: 1px solid #7F9DB9;font-weight: bold;">
							<c:choose>
								<c:when test="${other.is_free == IS_ABLE}">是</c:when>
								<c:otherwise>否</c:otherwise>
							</c:choose>
						</td>
						<td style="border: 1px solid #7F9DB9;font-weight: bold;">
							<c:choose>
								<c:when test="${other.is_subtract == IS_ABLE}">是</c:when>
								<c:otherwise>否</c:otherwise>
							</c:choose>
						</td>
						<td style="border: 1px solid #7F9DB9;font-weight: bold;" id="otherOP${status.index}">
							<c:if test="${other.status == 'order'}">
								<a href="#" onclick="onAuth(${other.id}, 0, ${status.index},'other')" style="cursor:pointer;">取消</a>
							</c:if>
						</td>
					</tr>
				</c:forEach>
			</table>
		</div>
		
		<div style="margin-left: 200px; margin-top: 25px;">
			<input type="button" name="returnBtn" value="返回 F5" onclick="onReturn()" />
		</div>
		
		<!-- 密码授权DIV -->
		<div id="passwordDiv" style="display: none;">
      		<table width="100%" style="margin-top: 20px;" border="0" align="center" cellpadding="4" cellspacing="4" bordercolor="#666666">
        		<tr>
          			<td width="80" align="right">授权帐户：</td>
          			<td><input type="password" id="operateAccount" name="operateAccount"/></td>
          		</tr>
          		<tr>
          			<td width="80" align="right">授权密码：</td>
          			<td><input type="password" id="operatePass" name="operatePass"/></td>
        		</tr>
      		</table>
    	</div>
	</body>
</html>